<script>
_h=h= Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var sWidth = parseInt((window.innerWidth > 0) ? window.innerWidth : screen.width);
if(sWidth>750){sWidth=750;}
var _rate=(sWidth/750);
if(h<_rate*1206){
   h=_rate*1206;
}
var _mbg=document.getElementById("mbg");
document.body.addEventListener('touchmove', function(e) {e.preventDefault();}, { passive: false }); 
$('html,body').css({overflow:'hidden',height:'100%',position:'fixed',left:0,top:0});
$(function(){
  
  $('.container').width(sWidth).height(h);
  $('.p-b').width(sWidth).height(h+10);
  $('.p1-t1').css({"top":_rate*220});
  $('.p1-t2').css({"top":_rate*1262});    
  $(".p1").animate({opacity:1});
  $('.arr').width(_rate*44).css({"bottom":'1.2%', "left":_rate*353});
  
  $('.p2-d1').width(_rate*271).css({"top":_rate*742, "left":_rate*102});
  $('.p2-d2').width(_rate*261).css({"top":_rate*742, "left":_rate*372});
  $('.p2-d3').width(_rate*271).css({"top":_rate*824, "left":_rate*102});
  $('.p2-d4').width(_rate*261).css({"top":_rate*824, "left":_rate*372});
  $('.p2-d5').width(_rate*271).css({"top":_rate*898, "left":_rate*102});
  $('.p2-d6').width(_rate*261).css({"top":_rate*898, "left":_rate*372});

  $('.p2-b1').width(_rate*312).css({"top":0, "left":0});
  $('.p2-t1').css({"top":_rate*182});
  $('.p2-z1').css({"top":_rate*160});
  

  $('.p2-b2').width(_rate*437).css({"top":_rate*624, "left":0});
  $('.p2-t2').css({"top":_rate*698});
  $('.p2-t3').css({"top":_rate*988});
  $('.p2-z2').css({"top":_rate*730});
  $('.p2-j1').width(_rate*294).height(_rate*104).css({"top":_rate*1264, "left":_rate*230});
  $('.p3-t1').css({"top":_rate*80});
  $('.p3-z1').css({"top":_rate*238});
  $('.p3-a1').css({"top":_rate*318});    
  $('.p3-a2').css({"top":_rate*480});     
  $('.p3-a3').css({"top":_rate*660});
  $('.p3-a4').css({"top":_rate*824});
  $('.p3-a5').css({"top":_rate*978});  
  $('.p4-t1').css({"top":_rate*122}); 
  $('.p4-t2').css({"top":_rate*244});     
  $('.p4-t3').css({"top":_rate*506});        
  $('.p4-a1').css({"top":_rate*622});
  $('.p4-a2').css({"top":_rate*724});
  $('.p4-a3').css({"top":_rate*826}); 
  $('.p4-a4').css({"top":_rate*926});
  $('.p4-a5').css({"top":_rate*1030});
  $('.p4-z1').css({"top":_rate*90});

  $('.p5-t1').css({"top":_rate*140}); 
  $('.p5-t2').width(_rate*289).css({"top":_rate*564, "left":_rate*64});
  $('.p5-t3').width(_rate*289).css({"top":_rate*564, "left":_rate*390}); 
  $('.p5-t4').width(_rate*326).css({"top":_rate*690, "left":_rate*50});
  $('.p5-t5').width(_rate*326).css({"top":_rate*690, "left":_rate*374});  
  
  $('.p6-t1').width(_rate*290).css({"top":_rate*90, "left":_rate*52});
  $('.p6-t2').css({"top":_rate*1076}); 
  $('.p6-b1').width(_rate*374).height(_rate*127).css({"top":_rate*1236, "left":_rate*190});
  $('.p6-z1').css({"top":_rate*240});
  $('.p6-slider').width(sWidth).height(_rate*615).css({"top":_rate*336, "left":0});
    
  $('.p6-left, .p6-left2').css({"left":0}); 
  $('.p6-right, .p6-right2').css({"right":0});
  $('.p6-left, .p6-right, .p6-left2, .p6-right2').width(_rate*182).height(_rate*370);
 
   
   
  var _cha;
 
    if(h < _rate*1531){
       _cha=h - _rate*1444;
       if(_cha < 0){_cha=0;}
       console.log(_cha);  
       $('.thebg').css({"top":_cha});
       $('.p1-t2').css({"top":_rate*1272}); 
    }
    if(h < _rate*1500){
        $('.p1-bg').css({"top":-_rate*20});
        $('.p1-t2').css({"top":_rate*1292}); 
    }
    if(h < _rate*1449){
       $('.p1-bg').css({"top":-_rate*30});
       $('.p1-t2').css({"top":_rate*1292}); 
    }
    if(h < _rate*1425){
       $('.p1-bg').css({"top":-_rate*50});
       $('.p1-t2').css({"top":_rate*1272}); 
    }
    if(h < _rate*1381){
      $('.p1-bg').css({"top":-_rate*70});
      $('.p1-t2').css({"top":_rate*1242}); 
      $('.p1-t1').css({"top":_rate*200});
      $('.p2-j1').css({"top":_rate*1234}); 
      $('.p3-t1').css({"top":_rate*60});
      $('.p3-z1').css({"top":_rate*188});
      $('.p3-a1').css({"top":_rate*268});    
      $('.p3-a2').css({"top":_rate*430});     
      $('.p3-a3').css({"top":_rate*610});
      $('.p3-a4').css({"top":_rate*774});
      $('.p3-a5').css({"top":_rate*928});

      $('.p5-t1').css({"top":_rate*120}); 
      $('.p5-t2').css({"top":_rate*544});
      $('.p5-t3').css({"top":_rate*544}); 
      $('.p5-t4').css({"top":_rate*670});
      $('.p5-t5').css({"top":_rate*670});
      $('.p6-b1').css({"top":_rate*1206});
    }
    
    if(h < _rate*1345){
      $('.p1-bg').css({"top":-_rate*100});
      $('.p1-t2').css({"top":_rate*1202}); 
      $('.p1-t1').css({"top":_rate*190}); 
      $('.p6-b1').css({"top":_rate*1136});
      $('.p2-d1').css({"top":_rate*712});
      $('.p2-d2').css({"top":_rate*712});
      $('.p2-d3').css({"top":_rate*794});
      $('.p2-d4').css({"top":_rate*794});
      $('.p2-d5').css({"top":_rate*868});
      $('.p2-d6').css({"top":_rate*868});
      $('.p2-b1').css({"top":0});
      $('.p2-t1').css({"top":_rate*162});
      $('.p2-b2').css({"top":_rate*604});
      $('.p2-t2').css({"top":_rate*698});
      $('.p2-t3').css({"top":_rate*958});
      $('.p2-z1').css({"top":_rate*140});
      $('.p2-z2').css({"top":_rate*700});
      $('.p2-j1').css({"top":_rate*1164});

      $('.p3-t1').css({"top":_rate*80});
      $('.p3-z1').css({"top":_rate*208});
      $('.p3-a1').css({"top":_rate*288});    
      $('.p3-a2').css({"top":_rate*450});     
      $('.p3-a3').css({"top":_rate*630});
      $('.p3-a4').css({"top":_rate*794});
      $('.p3-a5').css({"top":_rate*948});

      $('.p4-t1').css({"top":_rate*92}); 
      $('.p4-t2').css({"top":_rate*214});     
      $('.p4-t3').css({"top":_rate*476});        
      $('.p4-a1').css({"top":_rate*592});
      $('.p4-a2').css({"top":_rate*694});
      $('.p4-a3').css({"top":_rate*796}); 
      $('.p4-a4').css({"top":_rate*896});
      $('.p4-a5').css({"top":_rate*1000});
      $('.p4-z1').css({"top":_rate*60});

      $('.p5-t1').css({"top":_rate*110}); 
      $('.p5-t2').css({"top":_rate*544});
      $('.p5-t3').css({"top":_rate*544}); 
      $('.p5-t4').css({"top":_rate*660});
      $('.p5-t5').css({"top":_rate*660});  
      
      $('.p6-t1').css({"top":_rate*90});
      $('.p6-t2').css({"top":_rate*1046}); 
      $('.p6-b1').css({"top":_rate*1176});
      $('.p6-z1').css({"top":_rate*210});
      $('.p6-slider').css({"top":_rate*306});

    } 

    if(h < _rate*1321){
      $('.p1-bg').css({"top":-_rate*140});
      $('.p1-t2').css({"top":_rate*1162});
      $('.p1-t1').css({"top":_rate*160}); 
      
      $('.p3-t1').css({"top":_rate*60});
      $('.p3-z1').css({"top":_rate*188});
      $('.p3-a1').css({"top":_rate*268});    
      $('.p3-a2').css({"top":_rate*430});     
      $('.p3-a3').css({"top":_rate*610});
      $('.p3-a4').css({"top":_rate*774});
      $('.p3-a5').css({"top":_rate*928});

      $('.p6-t1').css({"top":_rate*70});
      $('.p6-t2').css({"top":_rate*1026}); 
      $('.p6-b1').css({"top":_rate*1156});
      $('.p6-z1').css({"top":_rate*190});
      $('.p6-slider').css({"top":_rate*286});
    }
    if(h < _rate*1251){
        $('.p1-bg').css({"top":-_rate*190});
        $('.p1-t2').css({"top":_rate*1142});
        $('.thebg').css({"top":-_rate*30});

        $('.p5-t1').css({"top":_rate*90}); 
        $('.p5-t2').css({"top":_rate*524});
        $('.p5-t3').css({"top":_rate*524}); 
        $('.p5-t4').css({"top":_rate*640});
        $('.p5-t5').css({"top":_rate*640});  
        $('.p6-b1').css({"top":_rate*1136});

    }
    if(h < _rate*1208){
        
       $('.p1-bg').css({"top":-_rate*220});
       $('.p1-t2').css({"top":_rate*1112});

       $(".p1-t1").addClass("iphone6");
 
        $('.p2-d1').css({"top":_rate*712});
        $('.p2-d2').css({"top":_rate*712});
        $('.p2-d3').css({"top":_rate*794});
        $('.p2-d4').css({"top":_rate*794});
        $('.p2-d5').css({"top":_rate*868});
        $('.p2-d6').css({"top":_rate*868});
        $('.p2-b1').css({"top":0});
        $('.p2-t1').css({"top":_rate*162});
        $('.p2-b2').css({"top":_rate*604}); 
        $('.p2-t2').css({"top":_rate*698});
        $('.p2-t3').css({"top":_rate*958});
        $('.p2-z1').css({"top":_rate*140});
        $('.p2-z2').css({"top":_rate*700});
        $('.p2-j1').css({"top":_rate*1144});
        $(".fix-iphone").addClass("iphone6");


        $('.p6-t1').css({"top":_rate*30});
        $('.p6-z1').css({"top":_rate*150});
        $('.p6-slider').css({"top":_rate*246});
        
        $('.p6-t2').css({"top":_rate*976}); 
        $('.p6-b1').css({"top":_rate*1076});
    }
 
    $('.p1-s1').width(sWidth).height(h);
    
    var mySwiper= new Swiper('.p6-slider', {
       autoplay: true,
       observe0r: true,//修改swiper自己或子元素时，自动初始化swiper
          observeParents: true,//修改swiper的父元素时，自动初始化swiper
       delay: 1000,
       speed:1000,
       loop:true,
       effect : 'slider',
       on: {
        init: function(){
              
        },
        slideChangeTransitionEnd: function(){
                 
        } 
       } 
      });
    
    var _s1 = new Swiper('.p1-s1', {
           initialSlide:0,
           direction : 'vertical',
           loop: true,
           speed:260,
               observe0r: true,//修改swiper自己或子元素时，自动初始化swiper
               observeParents: true,//修改swiper的父元素时，自动初始化swiper
           on: {
            init: function(swiper){

            },
            slideChangeTransitionStart: function(){
                $(".aniHide").hide();
                window.setTimeout(function(){
                  $(".aniHide").show();
                }, 200);
                console.log(this.activeIndex);
                //_s1.allowSlidePrev= true;
                if(1 == this.activeIndex || 7 == this.activeIndex){
                  // _s1.allowSlidePrev= false;
                }
            },
            slideChangeTransitionEnd: function(){
                  $(".aniHide").show();
                  if(5 == this.activeIndex){
                     
                  }
                  
            } 
           } 
          });
        function _check(){
            console.log(_s1.activeIndex);
            _s1.allowSlidePrev= true;
            if(1 == _s1.activeIndex || 7 == _s1.activeIndex){
                 _s1.allowSlidePrev= false;
            }
            
             window.setTimeout(function(){_check()}, 300);
        }
          _check(); 
    
    
     
     
   
    
    /**
      navigation: {
        nextEl: '.p6-right',
        prevEl: '.p6-left',
      }
      */

    
 $('.p6-left').click(function(){
     console.log(mySwiper);
     mySwiper.slideNext();
     // _s1.slideNext();
       
   });
    $('.p6-right').click(function(){
     console.log(mySwiper);
     mySwiper.slidePrev();
     // _s1.slideNext();
       
   });
     
   $(".p2-j1, .p6-b1").click(function(){
       _hmt.push(['_trackEvent', 'jump', 'click', '跳转']);   
      window.location.href="u.php";
   });
   
   var _mbgFlag=false;
   $(".bgm-btn-wraper").bind('touchstart', function(){
      if(true == _mbgFlag){
        $(".bgm-btn").removeClass("rotate");
        _mbgFlag=false;
        _mbg.pause();
        }else{
          $(".bgm-btn").addClass("rotate");
          _mbgFlag=true;
          _mbg.play();
          
      }
    });
  
  wx.config({
        appId: '<?php echo $signPackage["appId"];?>',
        timestamp: <?php echo $signPackage["timestamp"];?>,
        nonceStr: '<?php echo $signPackage["nonceStr"];?>',
        signature: '<?php echo $signPackage["signature"];?>',
        jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData', 'showMenuItems', 'hideMenuItems']
    });
    var _title='2022年海信专卖店盛大招商';
    var _desc='不负信赖，共赴未来！';
    var _link='http://mei94.com/hisense/';
    var _imgUrl='http://mei94.com/hisense/img/65.jpg';
    wx.ready(function () {
        wx.updateAppMessageShareData({
            title: _title, 
            desc: _desc, 
            link: _link, 
            imgUrl: _imgUrl,success: function () {}
          });
         wx.updateTimelineShareData({
                title: _title, 
                link: _link, 
                imgUrl: _imgUrl, success: function () {}});
    });


    document.addEventListener("WeixinJSBridgeReady", function () {
          _mbg.play();
          window.setTimeout(function(){
            _mbg.play();
          }, 400);
        }, false);
    _mbg.play();
    window.setTimeout(function(){
        $(".bgm-btn").removeClass("rotate");
        _mbgFlag=false;
        if(false == _mbg.paused){
            $(".bgm-btn").addClass("rotate");
            _mbgFlag=true;
        }
    }, 800);
         

      
});
</script>